package com.ibm;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConnection {
	Connection conn;
	String url="jdbc:mysql://localhost:3306/etpdb";
//	String url="jdbc:mysql://localhost:3306/discharge";
	String user="root";
	String password="123";
	String drivername="com.mysql.jdbc.Driver";
	public DBConnection() {
		super();
	}
	public DBConnection(Connection conn, String url, String user,
			String password, String drivername) {
		super();
		this.conn = conn;
		this.url = url;
		this.user = user;
		this.password = password;
		this.drivername = drivername;
	}
	
	public Connection getCnn() throws SQLException, ClassNotFoundException{
		Class.forName(drivername);
		conn = DriverManager.getConnection(url, user, password);
		return conn;
	}
	
	public void closeCnn() throws SQLException{
		conn.close();
	}
	
}
